<h1>Session Plugin</h1>

<p>The <em>session</em> plugin gives you the ability to set and read session data.</p>

<p>The session plugin's slug is <strong>session</strong>, so it can be used like so:</p>

<pre class="tags">{pyro:session:<em>function</em>}</pre>

<h2>Functions</h2>

<h3>{pyro:session:data}</h3>

<p>Displays or sets a piece of session data.</p>

<p>If this function is provided a value, it will set the session data and display nothing. If no value is provided, the value of the name provided will be displayed by the function.</p>

<p><strong>Parameters</strong></p>

<table cellpadding="0" cellspacing="0">

	<tr>
		<th>Parameter</th>
		<th>Description</th>
	</tr>
	
	<tr>
		<td width="100">name</td>
		<td>Required. Name of the data you want to display or set.</td>
	</tr>
	<tr>
		<td width="100">value</td>
		<td>Required if you want to set the session data. Value of the data you want to set.</td>
	</tr>

</table>

<p><strong>Example (Displaying Data):</strong></p>

<pre><code>{pyro:session:data data="color_preference"}</code></pre>

<pre><code>red</code></pre>

<p><strong>Example (Setting Data):</strong></p>

<pre><code>{pyro:session:data data="color_preference" value="red"}</code></pre>

<br />

<h3>{pyro:session:flash}</h3>

<p>Identical to the <em>data</em> function, but uses flash data.</p>

<p>Flash data is data that is only available to the next page load before it is destroyed.</p>

<br />

<h3>{pyro:session:messages}</h3>

<p>Displays a flashdata message.</p>

<p>PyroCMS has standardized messages to belong to one of three categories:</p>

<ul>
	<li>success</li>
	<li>notice</li>
	<li>error</li>
</ul>

<p>PyroCMS modules use this syntax, so if you want to display success, notice, and error messages, you can use this function.</p>

<p><strong>Parameters</strong></p>

<table cellpadding="0" cellspacing="0">

	<tr>
		<th>Parameter</th>
		<th>Default</th>
		<th>Description</th>
	</tr>
	
	<tr>
		<td width="100">success</td>
		<td>success</td>
		<td>Div class name for success messages.</td>
	</tr>
	<tr>
		<td width="100">notice</td>
		<td>notice</td>
		<td>Div class name for notice messages.</td>
	</tr>
	<tr>
		<td width="100">error</td>
		<td>error</td>
		<td>Div class name for error messages.</td>
	</tr>

</table>

<p><em>Note: messages will only display if there is flash message data to display on a page load. Otherwise, the plugin will display nothing.</em></p>

<p><strong>Example:</strong></p>

<pre><code>{pyro:session:messages}</code></pre>

<pre><code>&lt;div class="error"&gt;There was an error.&lt;/div&gt;</code></pre>

<p><strong>Example (Custom Message Class):</strong></p>

<pre><code>{pyro:session:messages success="my_success_class"}</code></pre>

<pre><code>&lt;div class="my_success_class"&gt;Success!&lt;/div&gt;</code></pre>
